package br.com.cadele.beans;

import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import br.com.cadele.model.Disciplina;
import br.com.cadele.service.DisciplinaService;

import com.ocpsoft.pretty.faces.annotation.URLBeanName;
import com.ocpsoft.pretty.faces.annotation.URLMapping;

@ManagedBean(name="cadastrarDisciplinaBean")
@ViewScoped
@URLBeanName(value="cadastrarDisciplinaBean")
@URLMapping(id="cadastrarDisciplinaBean", pattern="/disciplina/cadastrar", viewId="/pages/disciplina/cadastrar.xhtml")
public class CadastrarDisciplinaBean implements Serializable{
	
	private static final long serialVersionUID = -3915522273137678801L;
	private Disciplina disciplina;
	private DisciplinaService disciplinaService;

	@PostConstruct
	public void init(){
		disciplina = new Disciplina();
		disciplinaService = new DisciplinaService();
	}
	
	public void salvar() {
		disciplinaService.executeInsert(disciplina);
	}
	
	public Disciplina getDisciplina() {
		return disciplina;
	}
	
	public void setDisciplina(Disciplina disciplina) {
		this.disciplina = disciplina;
	}
}
